package com.chinatechstar.decis.controller;

import com.chinatechstar.decis.dto.EconBenefitResultDTO;
import com.chinatechstar.decis.dto.EconBenefitWellDTO;
import com.chinatechstar.decis.dto.GeneralEffectResultDTO;
import com.chinatechstar.decis.dto.GeneralEffectWellDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.chinatechstar.decis.service.DesicEvaluationService;
import com.chinatechstar.component.commons.result.ActionResult;
import com.chinatechstar.component.commons.result.ResultBuilder;
import com.chinatechstar.component.commons.validator.InsertValidator;

/**
 * 智能评价决策 的控制层
 *
 * @author Rei
 */
@Api(value = "智能评价决策 的控制层", tags = {"智能评价决策"})
@RestController
@RequestMapping("/desicevaluation")
public class DesicEvaluationController {

    @Autowired
    private DesicEvaluationService desicEvaluationService;


    /**
     * 生成综合效果评价结果
     *
     * @param dto 评价传参
     */
    @ApiOperation(value = "生成综合效果评价结果", tags = {"智能评价决策"})
    @PostMapping(path = "/desicGeneralEffectEval")
    public ActionResult desicGeneralEffectEval(@Validated(InsertValidator.class) @RequestBody GeneralEffectWellDTO dto) {
        GeneralEffectResultDTO result = desicEvaluationService.generateGeneralEffect(dto);
        return ResultBuilder.buildActionSuccess(result);
    }

    /**
     * 生成经济效益评价结果
     *
     * @param dto 评价传参
     */
    @ApiOperation(value = "生成经济效益评价结果", tags = {"智能评价决策"})
    @PostMapping(path = "/desicEconBenefitEval")
    public ActionResult desicEconBenefitEval(@Validated(InsertValidator.class) @RequestBody EconBenefitWellDTO dto) {
        EconBenefitResultDTO result = desicEvaluationService.generateEconBenefit(dto);
        return ResultBuilder.buildActionSuccess(result);
    }

}
